<?php
/**
 * Created by PhpStorm.
 * User: witt
 * Date: 2017/12/20
 * Time: 16:00
 */
require MX_SHOP_PATH . 'core/web/mroles/page_merch.php';
class Index_MxShopPage extends Page {

    public function main(){

        global $_W, $_GPC;
        if($_W['ispost']){
            //验证令牌
            if(empty($_GPC['token']) || !checkToken($_GPC['token'])){
                show_json(0, '参数有误');
            }
            $ac = $_GPC['account'];
            $pwd = $_GPC['pwd'];

            $result = pdo_fetch('SELECT * FROM '.tablename('mx_shop_role_manage').' WHERE account = :account AND status = 1',
                array(
                    ':account'=>$ac
                )
            );
            if(!empty($result)){
                if(md5(md5($pwd).$result['salt']) == $result['password']){
                    show_json(1, array('message'=>'请求成功'));
                }
            }else{
                show_json(0, array('message'=>'帐号错误'));
            }
        }
        $token = getToken();
        include $this->template('mroles/login');
    }
    
}